package com.zhiyou100.reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class Demo1 {

    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        UserDao userDao = new UserDaoImpl();
        System.out.println(userDao.getClass());

        Class<?> aClass = Class.forName("com.zhiyou100.reflect.User");

        Method[] methods = aClass.getMethods();
        for (Method method : methods) {
            System.out.println(method.getName());
//            method.invoke();
        }
        Field[] fields = aClass.getFields();

        for (Field field : fields) {
            System.out.println("field.getName() = " + field.getName());
        }

        Object o = aClass.newInstance();
        System.out.println(o instanceof User);




    }
}
